#include "test_list.h"

#ifdef TEST_XCOMMAND

#define TEST_CASE_NAME os
#define TEST_NUMBER(n) XCommand##_##n

#include <os/xcommand.h>
#include <set>

using namespace os;


#define TEST_XCOMMAND_000
#define TEST_XCOMMAND_001
#define TEST_XCOMMAND_002
#define TEST_XCOMMAND_003
#define TEST_XCOMMAND_004
#define TEST_XCOMMAND_005
#define TEST_XCOMMAND_006
#define TEST_XCOMMAND_007
#define TEST_XCOMMAND_008
#define TEST_XCOMMAND_009
#define TEST_XCOMMAND_010
#define TEST_XCOMMAND_011
#define TEST_XCOMMAND_012
#define TEST_XCOMMAND_013
#define TEST_XCOMMAND_014
#define TEST_XCOMMAND_015
#define TEST_XCOMMAND_016
#define TEST_XCOMMAND_017
#define TEST_XCOMMAND_018
#define TEST_XCOMMAND_019
#define TEST_XCOMMAND_020
#define TEST_XCOMMAND_021
#define TEST_XCOMMAND_022
#define TEST_XCOMMAND_023
#define TEST_XCOMMAND_024
#define TEST_XCOMMAND_025
#define TEST_XCOMMAND_026
#define TEST_XCOMMAND_027
#define TEST_XCOMMAND_028
#define TEST_XCOMMAND_029
#define TEST_XCOMMAND_030
#define TEST_XCOMMAND_031
#define TEST_XCOMMAND_032

//------------------------------------------------------------------------------------------------------//
namespace{

    const os::path& start = WhereProgramIsRunning();
    const os::path& work = start/"tmp";
}
//------------------------------------------------------------------------------------------------------//

#ifdef TEST_XCOMMAND_000
TEST(TEST_CASE_NAME, TEST_NUMBER(000))
{
    const path target = work/"1/2/3";

    if(Exists(work))
        EXPECT_EQ(true, RemoveAll(work));

    EXPECT_EQ(true, XCreateDirectory(target));

    EXPECT_EQ(true, IsDir(work/"1"));
    EXPECT_EQ(true, IsDir(work/"1/2"));
    EXPECT_EQ(true, IsDir(work/"1/2/3"));

    if(Exists(work))
        EXPECT_EQ(true, RemoveAll(work));
}
#endif // TEST_XCOMMAND_000


#ifdef TEST_XCOMMAND_001
TEST(TEST_CASE_NAME, TEST_NUMBER(001))
{
    const path f1 = work/"1/file.txt";
    const path f2 = work/"1/2/file.txt";
    const path f3 = work/"1/2/3/file.txt";

    if(Exists(work))
        EXPECT_EQ(true, RemoveAll(work));

    EXPECT_EQ(true, XCreateFile(f1));
    EXPECT_EQ(true, XCreateFile(f2));
    EXPECT_EQ(true, XCreateFile(f3));

    EXPECT_EQ(true, IsFile(f1));
    EXPECT_EQ(true, IsFile(f2));
    EXPECT_EQ(true, IsFile(f3));

    if(Exists(work))
        EXPECT_EQ(true, RemoveAll(work));
}
#endif // TEST_XCOMMAND_001

#ifdef TEST_XCOMMAND_002
TEST(TEST_CASE_NAME, TEST_NUMBER(002))
{
    std::set<path> files;
    files.insert(work/"1/file.txt");
    files.insert(work/"1/2/file.txt");
    files.insert(work/"1/2/3/file.txt");
    
    if(Exists(work))
        EXPECT_EQ(true, RemoveAll(work));

    EXPECT_EQ(true, XCreateFile(files));

    EXPECT_EQ(true, IsFile(work/"1/2/file.txt"));
    EXPECT_EQ(true, IsFile(work/"1/file.txt"));
    EXPECT_EQ(true, IsFile(work/"1/2/3/file.txt"));

    if(Exists(work))
        EXPECT_EQ(true, RemoveAll(work));
}
#endif // TEST_XCOMMAND_002

#ifdef TEST_XCOMMAND_003
TEST(TEST_CASE_NAME, TEST_NUMBER(003))
{
    std::set<path> files;
    files.insert(work/"1/file.txt");
    files.insert(work/"1/2/file.txt");
    files.insert(work/"1/2/3/file.txt");

    const path dirs[] =
    {
        work/"1/2/4",
        work/"1/2/5",
        work/"1/2/6",
    };

    if(Exists(work))
        EXPECT_EQ(true,RemoveAll(work));

    EXPECT_EQ(true,XCreateFile(files));
    EXPECT_EQ(true,XCreateDirectory(dirs));

    EXPECT_EQ(true,IsFile(work/"1/2/file.txt"));
    EXPECT_EQ(true,IsFile(work/"1/file.txt"));
    EXPECT_EQ(true,IsFile(work/"1/2/3/file.txt"));

    EXPECT_EQ(true,IsDir(work/"1/2/4"));
    EXPECT_EQ(true,IsDir(work/"1/2/5"));
    EXPECT_EQ(true,IsDir(work/"1/2/6"));

    if(Exists(work))
        EXPECT_EQ(true,RemoveAll(work));
}
#endif // TEST_XCOMMAND_003

#ifdef TEST_XCOMMAND_004
TEST(TEST_CASE_NAME, TEST_NUMBER(004))
{
    const path work1 = work/"for_test1";
    const path work2 = work/"for_test2";

    std::set<path> list1;
    list1.insert(work1/"1/file.txt");
    list1.insert(work1/"1/2/file.txt");
    list1.insert(work1/"1/2/3/file.txt");

    std::set<path> list2;
    list2.insert(work2/"1/file.txt");
    list2.insert(work2/"1/2/file.txt");
    list2.insert(work2/"1/2/3/file.txt");

    if(Exists(work))
        EXPECT_EQ(true,RemoveAll(work));

    EXPECT_EQ(true, XCreateFile(list1));
    EXPECT_EQ(true, XCreateFile(list2));
    EXPECT_EQ(true, SameDirectory(work1, work2));

    if(Exists(work))
        EXPECT_EQ(true,RemoveAll(work));
}
#endif // TEST_XCOMMAND_004

#ifdef TEST_XCOMMAND_005
TEST(TEST_CASE_NAME, TEST_NUMBER(005))
{
}
#endif // TEST_XCOMMAND_005

#ifdef TEST_XCOMMAND_006
TEST(TEST_CASE_NAME, TEST_NUMBER(006))
{
}
#endif // TEST_XCOMMAND_006

#ifdef TEST_XCOMMAND_007
TEST(TEST_CASE_NAME,TEST_NUMBER(007))
{
}
#endif // TEST_XCOMMAND_007

#ifdef TEST_XCOMMAND_008
TEST(TEST_CASE_NAME,TEST_NUMBER(008))
{
}
#endif // TEST_XCOMMAND_008

#ifdef TEST_XCOMMAND_009
TEST(TEST_CASE_NAME,TEST_NUMBER(009))
{
}
#endif // TEST_XCOMMAND_009

#ifdef TEST_XCOMMAND_010
TEST(TEST_CASE_NAME,TEST_NUMBER(010))
{
}
#endif // TEST_XCOMMAND_010

#ifdef TEST_XCOMMAND_011
TEST(TEST_CASE_NAME,TEST_NUMBER(011))
{
}
#endif // TEST_XCOMMAND_011

#ifdef TEST_XCOMMAND_012
TEST(TEST_CASE_NAME,TEST_NUMBER(012))
{
}
#endif // TEST_XCOMMAND_012

#ifdef TEST_XCOMMAND_013
TEST(TEST_CASE_NAME,TEST_NUMBER(013))
{
}
#endif // TEST_XCOMMAND_013

#ifdef TEST_XCOMMAND_014
TEST(TEST_CASE_NAME,TEST_NUMBER(014))
{
}
#endif // TEST_XCOMMAND_014

#ifdef TEST_XCOMMAND_015
TEST(TEST_CASE_NAME,TEST_NUMBER(015))
{
}
#endif // TEST_XCOMMAND_015

#ifdef TEST_XCOMMAND_016
TEST(TEST_CASE_NAME,TEST_NUMBER(016))
{
}
#endif // TEST_XCOMMAND_016

#ifdef TEST_XCOMMAND_017
TEST(TEST_CASE_NAME,TEST_NUMBER(017))
{
}
#endif // TEST_XCOMMAND_017

#ifdef TEST_XCOMMAND_018
TEST(TEST_CASE_NAME,TEST_NUMBER(018))
{
}
#endif // TEST_XCOMMAND_018

#ifdef TEST_XCOMMAND_019
TEST(TEST_CASE_NAME,TEST_NUMBER(019))
{
}
#endif // TEST_XCOMMAND_019

#ifdef TEST_XCOMMAND_020
TEST(TEST_CASE_NAME,TEST_NUMBER(020))
{
}
#endif // TEST_XCOMMAND_020

#ifdef TEST_XCOMMAND_021
#endif // TEST_XCOMMAND_021

#ifdef TEST_XCOMMAND_022
#endif // TEST_XCOMMAND_022

#ifdef TEST_XCOMMAND_023
#endif // TEST_XCOMMAND_023

#ifdef TEST_XCOMMAND_024
#endif // TEST_XCOMMAND_024

#ifdef TEST_XCOMMAND_025
#endif // TEST_XCOMMAND_025

#ifdef TEST_XCOMMAND_026
#endif // TEST_XCOMMAND_026

#ifdef TEST_XCOMMAND_027
#endif // TEST_XCOMMAND_027

#ifdef TEST_XCOMMAND_028
#endif // TEST_XCOMMAND_029

#ifdef TEST_XCOMMAND_030
#endif // TEST_XCOMMAND_030

#ifdef TEST_XCOMMAND_031
#endif // TEST_XCOMMAND_031

#ifdef TEST_XCOMMAND_032
#endif // TEST_XCOMMAND_032

#endif



